package com.zxx.pattern.buildPattern.build4_ZZ;

/**
 * TextBuilder 实现类：
 * @author zxx on 2020/12/11
 */
public class TextBuilder extends Builder4 {

    StringBuffer sb = new StringBuffer();

    @Override
    public void makeTitle(String title) {
        sb.append("=====================");
        sb.append("[" + title + "]" + "\n");
    }

    @Override
    public void makeString(String string) {
        sb.append("@" + string + "\n");
    }

    @Override
    public void makeItems(String[] items) {
        for (String item : items) {
            sb.append("   ." + item + "\n");
        }
    }

    @Override
    public void close() {
        sb.append("=====================");
    }

    public String getResult() {
        return sb.toString();
    }

}
